
#pragma once

#include "zen_vap.h"

using namespace Zen;
using namespace Zen::Vap;

class MainDelegate : public Zen::Vap::ActivityDelegate {

	Point2 m_size;
public:
	void Init()
	{
		auto loader = std::shared_ptr<Zen::Vap::TextureLoader>();
		Zen::Vap::TextureCache::Instance()->SetTextureLoader(loader);

	}

	virtual void OnLaunch() override
	{
		m_size = { 800, 1600 };
		auto root = Zen::Vap::Activity::Instance()->GetRootNode();
		auto scene = root->AddNode<Scene2D>();
		
		{
			scene->ProjectView(0, 0, m_size.x, m_size.y);
			auto sprite = scene->AddNode<Zen::Vap::Sprite>();
			sprite->SetTexture(DefaultTextures::Instance()->GetCrossTexture());
			sprite->SetPosition(m_size / 2);
		}

		{
			GravityDustConfig config;
			auto emitor = GravityDustEmitor::Generate(config);
			auto dust = scene->AddNode<Dust>();
			dust->SetEmitor(emitor);
			dust->SetPosition(m_size / 3);
		}

		{
			GalaxyDustConfig config;
			auto emitor = GalaxyDustEmitor::Generate(config);
			auto dust = scene->AddNode<Dust>();
			dust->SetEmitor(emitor);
			dust->SetPosition(m_size / 4);
		}
	}

};
